package com.aspose.cells;

class zarm {
   private Workbook a;
   private zapy b;
   private zcfw c;
   private boolean d;
   private zark e;
   private zapj f;
   private static final com.aspose.cells.b.c.a.za g = new com.aspose.cells.b.c.a.za(new String[]{"automatic-styles", "font-face-decls", "body", "font-face", "name", "font-family", "spreadsheet", "table", "named-expressions", "content-validations", "named-expression", "named-range", "expression", "cell-range-address"});

   zarm(Workbook var1, zapy var2, boolean var3) {
      this.a = var1;
      this.b = var2;
      this.d = var3;
   }

   void a() throws Exception {
      if (this.c.n()) {
         this.c.a();
      } else {
         this.c.d();
         if (zass.a(this.c)) {
            this.c.d();

            while(zass.a(this.c)) {
               switch(g.a(this.c.p().toLowerCase())) {
               case 0:
                  if (this.d) {
                     this.c.a();
                  } else {
                     zare var1 = new zare(this.b, false);
                     var1.a(this.c);
                  }
                  break;
               default:
                  this.c.a();
               }
            }

            this.e = null;
         }
      }
   }

   void a(com.aspose.cells.a.f.zi var1) throws Exception {
      this.c = zasr.a(var1, "content.xml", false);
      this.a();
      this.c = zasr.a(var1, "content.xml", false);
      if (this.c.n()) {
         this.c.a();
      } else {
         this.c.d();
         if (zass.a(this.c)) {
            this.c.d();

            while(zass.a(this.c)) {
               switch(g.a(this.c.p().toLowerCase())) {
               case 0:
                  if (this.d) {
                     this.c.a();
                  } else {
                     zare var2 = new zare(this.b, false);
                     var2.b(this.c);
                  }
                  break;
               case 1:
                  if (this.d) {
                     this.c.a();
                  } else {
                     this.b();
                  }
                  break;
               case 2:
                  this.d();
                  break;
               default:
                  this.c.a();
               }
            }

            this.e = null;
         }
      }
   }

   private void b() throws Exception {
      if (this.c.n()) {
         this.c.a();
      } else {
         this.c.d();

         while(zass.a(this.c)) {
            switch(g.a(this.c.p())) {
            case 3:
               this.c();
               break;
            default:
               this.c.a();
            }
         }

      }
   }

   private void c() throws Exception {
      String var1 = null;
      String var2 = null;
      if (this.c.m()) {
         while(true) {
            if (!this.c.l()) {
               this.c.k();
               break;
            }

            switch(g.a(this.c.p())) {
            case 4:
               var1 = this.c.s();
               break;
            case 5:
               var2 = this.c.s();
            }
         }
      }

      if (var1 != null && this.b.q.get(var1) == null) {
         this.b.q.put(var1, var2);
      }

      this.c.a();
   }

   private void d() throws Exception {
      if (this.c.n()) {
         this.c.a();
      } else {
         this.c.d();

         while(zass.a(this.c)) {
            switch(g.a(this.c.p().toLowerCase())) {
            case 6:
               this.e();
               break;
            default:
               this.c.a();
            }
         }

      }
   }

   private void e() throws Exception {
      if (this.c.n()) {
         this.c.a();
      } else {
         int var1 = 0;
         this.b.c.put(this.b.p, 15);
         this.c.d();

         while(zass.a(this.c)) {
            switch(g.a(this.c.p().toLowerCase())) {
            case 7:
               if (this.d) {
                  if (this.f == null) {
                     this.f = new zapj(this.b);
                  }

                  zapz var2 = (zapz)this.b.n.get(var1++);
                  this.f.a(this.c, var2);
                  this.a(var2);
               } else {
                  if (this.e == null) {
                     this.e = new zark(this.b);
                  }

                  this.e.a(this.c);
               }
               break;
            case 8:
               if (!this.d) {
                  this.g();
               } else {
                  this.c.a();
               }
               break;
            case 9:
               this.f();
               break;
            default:
               this.c.a();
            }
         }

      }
   }

   private void a(zapz var1) throws Exception {
      if (var1.g.size() > 0) {
         this.f.a.a(var1);
      }

   }

   private void f() throws Exception {
      this.c.a();
   }

   private void g() throws Exception {
      if (this.c.n()) {
         this.c.a();
      } else {
         this.c.d();

         while(zass.a(this.c)) {
            switch(g.a(this.c.p().toLowerCase())) {
            case 10:
            case 11:
               this.h();
               break;
            default:
               this.c.a();
            }
         }

      }
   }

   private void h() throws Exception {
      String var1 = null;
      String var2 = null;
      String var3 = null;
      if (this.c.m()) {
         while(true) {
            if (!this.c.l()) {
               this.c.k();
               break;
            }

            switch(g.a(this.c.p())) {
            case 4:
               var1 = this.c.s();
               break;
            case 12:
               var2 = this.c.s();
               break;
            case 13:
               var3 = this.c.s();
            }
         }
      }

      this.c.a();
      if (var1 != null) {
         if (!var1.startsWith("Excel_BuiltIn")) {
            Name var4;
            if (var2 != null && !"".equals(var2)) {
               var4 = new Name(this.a.getWorksheets(), var1);
               var4.setRefersTo(zapj.a((String)var2, (String)null));
               this.a.getWorksheets().getNames().a(var4, true);
            } else {
               if (var3 == null || "".equals(var3)) {
                  return;
               }

               var4 = new Name(this.a.getWorksheets(), var1);
               String var5 = zaqh.f(var3);
               var4.setRefersTo('=' + var5);
               this.a.getWorksheets().getNames().a(var4, true);
            }

         }
      }
   }
}
